/*
 *  Copyright (C) 2009 Dominik Psenner
 * 
 *   This file is part of WebDAV4JD.
 *
 *  WebDAV4JD is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  WebDAV4JD is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with project-blog.  If not, see <http://www.gnu.org/licenses/>.
 *
 */
package com.lab9.webdav4jd.api.impl;

import java.util.Date;

import com.lab9.webdav4jd.api.DataSource;
import com.lab9.webdav4jd.api.Node;
import com.lab9.webdav4jd.api.WebDAVRepository;

/**
 * 
 * @author dominik
 * 
 */
public abstract class WebDAVRepositoryImpl implements WebDAVRepository {
	private final DataSource dataSource;
	
	/**
	 * constructs a new webdav repository. Provide a data source as it cannot be null!
	 * 
	 * @param dataSource
	 * @param url
	 */
	public WebDAVRepositoryImpl(final DataSource dataSource) {
		this.dataSource = dataSource;
	}
	
	protected final String getRepositoryURL() {
		return getDataSource().getURL();
	}
	
	protected final DataSource getDataSource() {
		return dataSource;
	}
	
	/**
	 * {@inheritDoc}
	 */
	@Override
	public final Node getNode(final String path) {
		final Node n = createNode();
		// TODO Auto-generated method stub
		return n;
	}
	
	/**
	 * {@inheritDoc}
	 */
	@Override
	public final Node getNode(final String path, final Date revisionNear) {
		final Node n = createNode();
		// TODO Auto-generated method stub
		return n;
	}
	
	/**
	 * {@inheritDoc}
	 */
	@Override
	public final Node getNode(final String path, final int revision) {
		final Node n = createNode();
		// TODO Auto-generated method stub
		return n;
	}
	
	private Node createNode() {
		return new NodeImpl();
	}
	
	protected abstract void _USE_THE_FACTORY();
}
